<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	<title>title</title>
	<link rel="stylesheet" type="text/css" href="../css/api.css" />
	<!-- <link rel="stylesheet" type="text/css" href="../css/mzui/css/mzui.min.css" /> -->
	<style>
		th {
			text-align: center;
		}

		td {
			text-align: center;
		}

		.infoTop {
			background-color: #d65b5d;
			height: 73px;
			/* border-bottom:1px solid #994c00; */
			text-align: center;
			/* border:1px solid red; */
		}

		.infoTop a {
			position: absolute;
			height: 37px;
			padding: 34px 20px 0 20px;
			top: 0px;
			left: 0px;
			cursor: pointer;
		}

		.infoTop img {
			height: 25px;
		}

		.infoTop span {
			position: absolute;
			top: 24px;
			left: 140px;
			font-size: 20px;
			height: 50px;
			line-height: 50px;
			color: #fff;
			cursor: default;
		}

		.infoTop .nav {
			float: left;
			width: 25px;
			height: 25px;
			margin: 35px 15px auto 20px;
		}

		.infoTop .moretype {
			position: absolute;
			top: 29px;
			right: 15px;
			height: 40px;
			width: 40px;
			line-height: 40px;
			color: #fff;
			cursor: pointer;
			background: url() no-repeat right 10px;
			/*background:url() no-repeat right 10px;*/
			background-size: 20px 20px;
		}

		.addUser {
			height: 40px;
			text-align: center;
			font-size: 14px;
			border-bottom: 1px solid #d1d0d0;
		}

		.addUser img {
			float: left;
			margin: 9px 10px 0 127px;
			width: 22px;
			height: 22px;
		}

		.addUser span {
			float: left;
			height: 40px;
			line-height: 40px;
		}

		body,
		html {
			margin: 0;
			padding: 0;
			color: #333;
			font-family: "Microsoft YaHei", "Helvetica", sans-serif;
			background-color: #f0f0f0 !important;
		}
		/*  订单列表css  start  */

		.orderbox .bigBG {
			background-color: #fff;
			margin-top: 5px;
		}

		.orderbox .orderNum {
			font-size: 16px;
			line-height: 32px;
			border-bottom: 2px solid #e5e5e5;
			position: relative;
		}

		.orderbox .orderNum span {
			display: block;
			color: #666;
			margin: 0 15px;
			/* border:1px solid red; */
		}

		.orderbox .orderNum .delete {
			position: absolute;
			top: 13px;
			right: 15px;
			width: 18px;
			height: 22px;
			cursor: pointer;
			outline: none;
			border: none;
			background: none;
			background-image: url("../../image/order/icon-del1.png");
			background-repeat: no-repeat;
			background-size: 20px 20px;
		}

		.orderbox .orderNum .delete:hover {
			background-image: url("../../image/order/icon-del2.png");
		}

		.orderbox .orderNum .delete:active {
			background-image: url("../../image/order/icon-del2.png");
		}
		/* 订单删除按钮遮罩层  start */

		.delbg {
			display: none;
			width: 100%;
			height: 100%;
			position: fixed;
			top: 0;
			left: 0;
			z-index: 999999;
			background-color: #000;
			background-color: rgba(0, 0, 0, 0.6);
		}

		.delbg .show {
			width: 280px;
			height: 160px;
			margin: 0 auto;
			margin-top: 140px;
			border-radius: 4px;
			background-color: #fff;
			overflow: auto;
		}

		.delbg .show .showtext {
			margin: 0;
			padding: 0;
			margin-top: 40px;
			font-size: 20px;
			line-height: 20px;
			color: #333;
			text-align: center;
			/* border:1px solid red; */
		}

		.delbg .show .btnalign {
			text-align: center;
			margin-top: 20px;
			/* border:1px solid red; */
		}

		.delbg .show .btnclose {
			margin: 0;
			padding: 0;
			border: none;
			outline: none;
			border-radius: 4px;
			width: 60px;
			height: 30px;
			color: #fff;
			font-family: "微软雅黑";
			font-size: 16px;
			cursor: pointer;
			background-color: #ff7f00;
		}

		.delbg .show .btnsure {
			margin: 0;
			padding: 0;
			margin-left: 32px;
			border: none;
			outline: none;
			text-decoration: none;
			border-radius: 4px;
			width: 60px;
			height: 30px;
			color: #fff;
			font-family: "微软雅黑";
			font-size: 16px;
			cursor: pointer;
			background-color: #ff7f00;
		}

		.delbg .show .btnclose:hover,
		.delbg .show .btnsure:hover {
			background-color: #e57300;
		}

		.delbg .show .btnclose:active,
		.delbg .show .btnsure:active {
			background-color: #f52222;
		}
		/* 订单删除按钮遮罩层  end */

		#pullUp {
			color: #C6C5C5;
			display: none;
			margin: 0px;
			background-color: transparent;
			text-align: center;
		}

		.orderbox .orderText p {
			margin: 0 15px;
			color: #999;
			border-bottom: 1px solid #eee;
			font-size: 14px;
			height: 26px;
			line-height: 26px;
			/* border:1px solid red;  */
		}

		.orderbox .orderText input {
			border: 1px solid #e5e5e5;
			height: 25px;
			weight: 75px;
			/* border:1px solid red;  */
		}

		.orderbox .orderbottom {
			height: 36px;
			line-height: 36px;
			border-bottom: 2px solid #e5e5e5;
		}

		.orderbox .orderbottom span {
			margin-left: 15px;
			font-size: 14px;
			color: #999;
		}

		.orderbox .orderbottom input {
			border: 1px solid #e5e5e5;
			height: 25px;
			weight: 75px;
		}

		.orderbox .orderbottom select {
			border: 1px solid #e5e5e5;
			height: 25px;
		}

		.orderbox .orderbottom button {
			float: right;
			width: 65px;
			height: 28px;
			border-radius: 4px;
			border: none;
			outline: none;
			line-height: 32px;
			font-size: 14px;
			margin-right: 15px;
			margin-top: 4px;
			color: #fff;
			background-color: #2f889a;
			cursor: pointer;
		}

		.orderbox .orderbottom button:hover {
			background-color: #2f889a;
		}

		.orderbox .orderbottom button:active {
			background-color: #2f889a;
		}

		.orderbox .lastP {
			margin: 0;
			padding: 0;
			font-size: 14px;
			line-height: 28px;
			border-bottom: 1px solid #ddd;
			text-align: center;
			cursor: pointer;
		}

		.orderbox .lastP a {
			color: #2f889a;
			font-size: 15px;
			text-decoration: none;
		}
		/*  订单列表css  end  */
		/* 订单页为空时的友情提示css start */

		#hint {
			text-align: center;
		}

		#hint img {
			width: 40px;
			margin-top: 60px;
		}

		#hint p {
			margin: 0;
			padding: 0;
			margin-top: 10px;
			font-size: 14px;
			color: #999;
		}
		/* 订单页为空时的友情提示css end */
		/* 底部nav空白占位 css  */

		.zero {
			display: block;
			height: 60px;
		}

		.save-btn {
			position: fixed;
			bottom: 0px;
			padding-left: 59px;
			padding-right: 59px;
			height: 56px;
			width: 100%;
			background-color: #FFFFFF;
			display: block;
		}

		.save-btn #svBtn {
			display: inline-block;
			height: 35px;
			width: 242px;
			margin-top: 12px;
			border: none;
			background-color: #D65B5D;
			border-radius: 10px;
			outline: none;
			color: #fff;
			font-size: 16px;
			font-family: "方正兰亭黑简体", "Microsoft YaHei";
			line-height: 16px;
			text-align: center;
			cursor: pointer;
			text-decoration: none;
		}

		.save-btn #svBtn:hover {
			background-color: #d65b5d;
		}

		.save-btn #svBtn:active {
			background-color: #FFAEB9;
		}
	</style>
</head>

<body>

	<!-- <div class="infoTop">
	        <!--<img class="nav" id="openMenu" src=""/>
			 <a onClick="javascript :api.closeFrame();"><img alt="返回" src="" title="back"></a>
			<span>试块入库</span>
			<!-- <div class="moretype" onclick="showscanner()"> </div> -->
	<!--</div>-->
	<div id="wrapper">
		<ul id="thelist" class="orderbox">
			<div class="bigBG">
				<div class="orderbottom">
					<form id="orderComment" name="orderComment" method="get"><span>产品名称：</span><input id="productName" name="productName" type="text" /></form>
				</div>
				<div class="orderbottom">
					<form id="orderComment" name="orderComment" method="get"><span>图&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号：</span><input id="figureNumber" name="figureNumber" type="text" /></form>
				</div>
				<div class="orderbottom">
					<form id="orderComment" name="orderComment" method="get"><span>材&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;质：</span><input id="texture" name="texture" type="text" /></form>
				</div>
				<div class="orderbottom">
					<form id="orderComment" name="orderComment" method="get"><span>铸&nbsp;&nbsp;件&nbsp;&nbsp;号：</span><input id="castingNum" name="castingNum" type="text" /></form>
				</div>
				<div class="orderbottom">
					<form id="orderComment" name="orderComment" method="get"><span>顾&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;客：</span><input id="customer" name="blockNo" type="text" /></form>
				</div>
				<div class="orderbottom">
					<form id="orderComment" name="orderComment" method="get"><span>位&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;置：</span></form>
				</div>
				<div class="orderbottom">
					<form id="orderComment" name="orderComment" method="get"><span>试块编号：</span><input id="blockNo" name="blockNo" type="text" /></form>
				</div>
				<div class="orderbottom">
					<form id="orderComment" name="orderComment" method="get"><span>炉&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;次：</span><input id="meltingStove" name="meltingStove" type="text" /></form>
				</div>
				<div class="orderbottom">
					<form id="orderComment" name="orderComment" method="get"><span>入库数量：
		</span><input id="number" name="number" type="text" />
					</form>
				</div>
				<div class="orderbottom">
					<form id="orderComment" name="orderComment" method="get"><span>试样类型：
		</span><select id="blockType" name="blockType"><option value="">请选择</option><option value="单铸" >单铸</option><option value="附铸" >附铸</option><option value="实物" >实物</option><option value="其他" >其他</option></select>
					</form>
				</div>
				<div class="orderbottom">
					<form id="orderComment" name="orderComment" method="get"><span>存储期限：
		</span><input id="deadline" name="deadline" type="text" width="60px" />个月
					</form>
				</div>
			</div>
		</ul>
	</div>
	<input type="hidden" id="location" name="location" />
	<input type="hidden" id="retL" />
	<!--<div class="save-btn" id="save-btn">
	        <button type="button" id="svBtn" onclick="saveMaterial()">确认</button>
	   </div> -->
</body>
<script type="text/javascript" src="../script/public/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/core/core.js"></script>
<!--<script type="text/javascript" src="../script/mzui/js/mzui.min.js"></script>-->
<script type="text/javascript">
	apiready = function() {
		var customer = api.pageParam.customer;
		var productName = api.pageParam.productName;
		var figureNumber = api.pageParam.figureNumber;
		var texture = api.pageParam.texture;
		var castingNum = api.pageParam.castingNum;
		var productCode = api.pageParam.productCode;
		var pureTime = api.pageParam.pureTime;
		//alert(deductionId+"!!!"+deductionNo+"??"+mRNo);

		var UICustomPicker = api.require('UICustomPicker');
		UICustomPicker.open({
			rect: {
				x: 60,
				y: 186,
				w: 155,
				h: 50
			},
			styles: {
				bg: 'rgba(0,0,0,0)',
				normalColor: '#959595',
				selectedColor: '#d65b5d',
				selectedSize: 20,
				tagColor: '#d65b5d',
				tagSize: 15
			},
			data: [{
				tag: '架',
				scope: '0-8'
			}, {
				tag: '层',
				scope: ['1', '2', '3', '4']
			}, {
				tag: '',
				scope: ['L', 'R']
			}],
			rows: 3,
			fixedOn: 'frm_inStorageForAdd',
			fixed: false
		}, function(ret, err) {
			if (ret.data) {
				//alert( JSON.stringify( ret.data ) );
				$("input[name='location']").val(ret.data[0] + "-" + ret.data[1]);
			} else {
				//alert( JSON.stringify( err ) );
			}
		});
		//				UICustomPicker.hide({id: 0});
		//				UICustomPicker.hide({id: 1});


		//exitApp();
		//右滑打开菜单
		api.addEventListener({
			name: 'swiperight'
		}, function(ret, err) {
			api.openFrame({
				name: 'leftMenu',
				url: 'left_menu.html',
				rect: {
					x: 0,
					y: 0,
					w: api.winWidth / 2,
					h: api.winHeight
				}
			});
		});

		//测试--不能触屏

		$("#openMenu").click(function() {
			api.openFrame({
				name: 'leftMenu',
				url: 'left_menu.html',
				rect: {
					x: 0,
					y: 0,
					w: api.winWidth / 2,
					h: api.winHeight
				}
			});
		});

		var blockNoEl = $api.byId('blockNo');

		$api.addEvt(blockNoEl, 'blur', function(){
			// var blockNo = $("#blockNo").val();
			// var data = {
			// 	blockNo: blockNo
			// }
			// ajaxLocal(data, 'blockInventory', 'isExistedBlockNo', function(ret, err) {
			// 	if(ret.success == true)
			// 	{
			// 		alert("试块编号已存在");
			// 	}
			// });
		});



	};
	//点击确认键函数
	function saveMaterial() {
		var customer = $("#customer").val();
		var productName = $("#productName").val();
		var figureNumber = $("#figureNumber").val();
		var texture = $("#texture").val();
		var castingNum = $("#castingNum").val();
		var productCode = $("#productCode").val();
		var pureTime = $("#pureTime").val();
		var location = $("#location").val();
		var blockType = $("#blockType").val();
		var userId = $api.getStorage("user").objId;
		var number = $('#number').val();
		var blockNo = $("#blockNo").val();
		var deadline = $("#deadline").val();
		var meltingStove = $("#meltingStove").val();
		if (productName == '') {
			alert("请输入产品名称！");
			return false;
		}
		// else if(figureNumber==''){
		// 	alert("请输入图号！");
		// 	return false;
		// }else if(texture==''){
		// 	alert("请输入材质！");
		// 	return false;
		// }
		else if (castingNum == '') {
			alert("请输入铸件号！");
			return false;
		}
		// else if(customer==''){
		// 	alert("请输入顾客名称！");
		// 	return false;
		// }
		else if (location == '') {
			alert("请选择试块位置！");
			return false;
		} else if (blockType == '') {
			alert("请选择试块类型！");
			return false;
		} else if (number == '') {
			alert("请输入试块数量！");
			return false;
		} else if (blockNo == '') {
			alert("请输入试块编号！");
			return false;
		} else if (deadline == '') {
			alert("请输入存储期限！");
			return false;
		} else {



			var data = {
				customer: customer,
				productName: productName,
				figureNumber: figureNumber,
				texture: texture,
				castingNum: castingNum,
				productCode: productCode,
				pureTime: pureTime,
				location: location,
				blockType: blockType,
				number: number,
				userId: userId,
				blockNo: blockNo,
				deadline: deadline,
				meltingStove: meltingStove
			};

			ajaxLocal(data, 'blockInventory', 'saveBlock', function(ret, err) {
				//alert("验证成功!!"+JSON.stringify(ret));
				api.openWin({
					name: 'win_inStorage',
					url: 'win_inStorage.html',
					reload: true,
					rect: {
						x: 0,
						y: 0,
						w: 'auto',
						h: 'auto'
					}
				});
				api.closeWin({
					name: 'win_inStorageForAdd'
				});
				//  	 api.closeFrame({
				//	           name: 'frm_inStorageForOne'
				//         });
			});
		}
	}


	//查看详情
	function orderDetail(sendNumber, planId) {
		api.openWin({
			name: 'win_allocateDetail',
			url: 'win_allocateDetail.html',
			reload: true,
			pageParam: {
				planId: planId,
				sendNumber: sendNumber
			},
			rect: {
				x: 0,
				y: 0,
				w: 'auto',
				h: 'auto'
			}
		});
	}
</script>

</html>
